#include "OSMRelation.h"
#include <QString>

OSMRelation::OSMRelation()
{

}

unsigned int OSMRelation::getId()
{
    return m_id;
}

void OSMRelation::setId(unsigned int id)
{
    m_id = id;
}

void OSMRelation::addNodeId(unsigned int nodeId)
{
    m_nodeIds.push_back(nodeId);
}

void OSMRelation::addWayId(unsigned int wayId, const QString& role)
{
    m_wayIds.insert(role, wayId);
}

void OSMRelation::addRelationId(unsigned int relationId)
{
    m_relationIds.push_back(relationId);
}

bool OSMRelation::isMultipolygon()
{
    QString key("type");

    if(m_features.contains(key))
    {
        if(m_features.value(key) == "multipolygon")
        {
            return true;
        }
    }

    return false;
}

void OSMRelation::addFeature(const QString& key, const QString& value)
{
    m_features.insert(key, value);
}

const QMap<QString, QString>* OSMRelation::getFeatures()
{
    return &m_features;
}

QList<int> OSMRelation::getOuterWays()
{
    return m_wayIds.values("outer");
}

QList<int> OSMRelation::getInnerWays()
{
    return m_wayIds.values("inner");
}